<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Person(){
            this.name = 'xiaoming'
            this.colors = ['red','blue','green']
        }

        Person.prototype.getName = function(){
            console.log(this.name);
        }

        function Child(age){
            Person.call(this)
            this.age = age
        }

        var child1 = new Child(23);
        var child2 = new Child(12);
        child1.colors.push('yellow')
        console.log(child1.name);//xiaoming
        console.log(child1.colors);//(4) ['red', 'blue', 'green', 'yellow']
        console.log(child2.colors);//(3) ['red', 'blue', 'green']
    </script>
</body>
</html>